{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "import os\n",
    "\n",
    "os.environ['GOOGLE_APPLICATION_CREDENTIALS'] = 'mesolitica-storage.json'"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "from google.cloud import storage\n",
    "client = storage.Client()\n",
    "bucket = client.bucket('mesolitica-general')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "['t5-data/dumping-iium-pair.tsv',\n",
       " 't5-data/dumping-iium.tsv',\n",
       " 't5-data/dumping-news-pair.tsv',\n",
       " 't5-data/dumping-news.tsv',\n",
       " 't5-data/dumping-parliament-pair.tsv',\n",
       " 't5-data/dumping-parliament.tsv',\n",
       " 't5-data/dumping-pdf-pair.tsv',\n",
       " 't5-data/dumping-pdf.tsv',\n",
       " 't5-data/dumping-watpadd-pair.tsv',\n",
       " 't5-data/dumping-watpadd.tsv',\n",
       " 't5-data/dumping-wiki-pair.tsv',\n",
       " 't5-data/dumping-wiki.tsv',\n",
       " 't5-data/news-title.tsv',\n",
       " 't5-data/news-title2.tsv',\n",
       " 't5-data/qa-train.tsv',\n",
       " 't5-data/qa-validation.tsv',\n",
       " 't5-data/quora-0-100k.tsv',\n",
       " 't5-data/quora-100k-200k.tsv',\n",
       " 't5-data/quora-200k-300k.tsv',\n",
       " 't5-data/quora-300k-400k.tsv',\n",
       " 't5-data/quora-400k-500k.tsv',\n",
       " 't5-data/snli-part1.tsv',\n",
       " 't5-data/snli-part2.tsv',\n",
       " 't5-data/snli-part3.tsv',\n",
       " 't5-data/snli-part4.tsv',\n",
       " 't5-data/snli-part5.tsv',\n",
       " 't5-data/snli-part6.tsv',\n",
       " 't5-data/snli-part7.tsv',\n",
       " 't5-data/stemming.tsv',\n",
       " 't5-data/synonyms.tsv']"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "blobs = client.list_blobs('mesolitica-general')\n",
    "t5_data = [blob.name for blob in blobs if 't5-data' in blob.name]\n",
    "t5_data"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [],
   "source": [
    "!mkdir t5-data"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "t5-data/dumping-iium-pair.tsv\n",
      "t5-data/dumping-iium.tsv\n",
      "t5-data/dumping-news-pair.tsv\n",
      "t5-data/dumping-news.tsv\n",
      "t5-data/dumping-parliament-pair.tsv\n",
      "t5-data/dumping-parliament.tsv\n",
      "t5-data/dumping-pdf-pair.tsv\n",
      "t5-data/dumping-pdf.tsv\n",
      "t5-data/dumping-watpadd-pair.tsv\n",
      "t5-data/dumping-watpadd.tsv\n",
      "t5-data/dumping-wiki-pair.tsv\n",
      "t5-data/dumping-wiki.tsv\n",
      "t5-data/news-title.tsv\n",
      "t5-data/news-title2.tsv\n",
      "t5-data/qa-train.tsv\n",
      "t5-data/qa-validation.tsv\n",
      "t5-data/quora-0-100k.tsv\n",
      "t5-data/quora-100k-200k.tsv\n",
      "t5-data/quora-200k-300k.tsv\n",
      "t5-data/quora-300k-400k.tsv\n",
      "t5-data/quora-400k-500k.tsv\n",
      "t5-data/snli-part1.tsv\n",
      "t5-data/snli-part2.tsv\n",
      "t5-data/snli-part3.tsv\n",
      "t5-data/snli-part4.tsv\n",
      "t5-data/snli-part5.tsv\n",
      "t5-data/snli-part6.tsv\n",
      "t5-data/snli-part7.tsv\n",
      "t5-data/stemming.tsv\n",
      "t5-data/synonyms.tsv\n"
     ]
    }
   ],
   "source": [
    "for file in t5_data:\n",
    "    print(file)\n",
    "    blob = bucket.blob(file)\n",
    "    blob.download_to_filename(file)"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.8"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
